/**
 * 前台filterHelper
 */
function gridFilter() {
	// 存储filter的容器
	var filterDatas = new Array();

	// 包装filter数据
	function formFilterData(fieldName, value, value1, operater, filterLogical) {
		var filterData = new Object();
		filterData.fieldName = fieldName;
		filterData.value = value;
		filterData.value1 = value1;
		filterData.operater = operater;
		filterData.filterLogical = filterLogical;
		return filterData;
	}
	// 添加filter
	function addFilterData(data) {
		for (var i = 0, length = filterDatas.length; i < length; i++) {
			var compareData = filterDatas[i];
			if (data.fieldName == compareData.fieldName
					&& data.operater == compareData.operater
					&& data.filterLogical == compareData.filterLogical) {
				filterDatas[i] = data;
				return;
			}
		}
		filterDatas.push(data);
	}
	// 获取所有filter
	function getFilterData() {
		return filterDatas;
	}
	// 清空filter
	function clearFilterData() {
		filterDatas.clear();
	}
	// 删除filter
	function delFilterData(data) {
		for (var i = 0, length = filterDatas.length; i < length; i++) {
			var compareData = filterDatas[i];
			if (data.fieldName == compareData.fieldName
					&& data.value == compareData.value
					&& data.operater == compareData.operater
					&& data.filterLogical == compareData.filterLogical) {
				filterDatas.removeAt(i);
				return;
			}
		}
	}
	return {
		formFilterData : formFilterData,
		addFilterData : addFilterData,
		getFilterData : getFilterData,
		clearFilterData : clearFilterData,
		delFilterData : delFilterData
	};

}

/**
 * commonTools
 */
(function($) {
	var BrowserType = {
		IE7 : "MSIE 7.0",
		IE8 : "MSIE 8.0",
		IE9 : "MSIE 9.0",
		IE10 : "MSIE 10.0",
		Chrome : "Chrome",
		Firefox : "Firefox",
		Safari : "Safari"
	},

	// 包装rowsId成逗号链接的字符串
	formatRowIds = function(rows, IDFiled, splitter) {
		var IdStr = "";
		for (var i = 0, length = rows.length; i < length; i++) {
			var Id = eval("rows[i]." + IDFiled);
			if (i != 0) {
				IdStr += splitter;
			}
			IdStr += Id;

		}
		return IdStr;
	},
	// 获取cookie值
	getCookie = function(c_name) {
		if (document.cookie.length > 0) {
			c_start = document.cookie.indexOf(c_name + "=");
			if (c_start != -1) {
				c_start = c_start + c_name.length + 1;
				c_end = document.cookie.indexOf(";", c_start);
				if (c_end == -1)
					c_end = document.cookie.length;
				return unescape(document.cookie.substring(c_start, c_end));
			}
		}
		return "";
	},

	// 设置cookie值
	setCookie = function(c_name, value, expiredays, path) {
		var exdate = new Date();
		exdate.setDate(exdate.getDate() + expiredays);
		document.cookie = c_name
				+ "="
				+ escape(value)
				+ ((expiredays == null) ? "" : ";expires="
						+ exdate.toGMTString())
				+ ((path == null) ? "" : (";path=" + path));
	},

	// 获取浏览器版本
	getBrowserVersion = function() {
		if (navigator.userAgent.indexOf("MSIE 7.0") > 0) {
			return BrowserType.IE7;
		}
		if (navigator.userAgent.indexOf("MSIE 8.0") > 0) {
			return BrowserType.IE8;
		}
		if (navigator.userAgent.indexOf("MSIE 9.0") > 0) {
			return BrowserType.IE9;
		}
		if (navigator.userAgent.indexOf("MSIE 10.0") > 0) {
			return BrowserType.IE10;
		}
		if (navigator.userAgent.indexOf("Firefox") > 0) {
			return BrowserType.Firefox;
		}
		if (navigator.userAgent.indexOf("Chrome") > 0) {
			return BrowserType.Chrome;
		}
		if (navigator.userAgent.indexOf("Safari") > 0) {
			return BrowserType.Safari;
		}
	},
	// 获取url中参数
	getUrlParam = function(name) {
		return getParamByName(window.location, name);
	}, getParamByName = function(url, name) {
		var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); // 构造一个含有目标参数的正则表达式对象
		var r = url.search.substr(1).match(reg); // 匹配目标参数
		if (r != null)
			return unescape(r[2]);
		return null; // 返回参数值
	},
	// 获取当前路径
	getWindowLocation = function() {
		var localAddr = window.location.href;
		var localAddrArray = localAddr.split("?");
		if (localAddrArray != null) {
			return localAddrArray[0];
		}
	},
	// 获取当前参数
	getAllUrlParams = function() {
		var localAddr = window.location.href;
		var localAddrArray = localAddr.split("?");
		if (localAddrArray != null && localAddrArray.length > 1) {
			return localAddrArray[1];
		} else {
			return null;
		}
	}, refreshSubPageHeight = function() {
		var $contentFrame = $("#contentFrame");
		$contentFrame.css("height", $(window).height() - 32);
	}, dateGMTToStr = function(date, format) {
		if (typeof date != "undefined" && date != null && date != "") {
			return dateFormat(new Date(date), format);
		} else {
			return date;
		}
	}, dateFormat = function(date, format) {
		if (format === undefined) {
			format = date;
			date = new Date();
		}
		var map = {
			"M" : date.getMonth() + 1, // 月份
			"d" : date.getDate(), // 日
			"h" : date.getHours(), // 小时
			"m" : date.getMinutes(), // 分
			"s" : date.getSeconds(), // 秒
			"q" : Math.floor((date.getMonth() + 3) / 3), // 季度
			"S" : date.getMilliseconds()
		// 毫秒
		};
		format = format.replace(/([yMdhmsqS])+/g, function(all, t) {
			var v = map[t];
			if (v !== undefined) {
				if (all.length > 1) {
					v = '0' + v;
					v = v.substr(v.length - 2);
				}
				return v;
			} else if (t === 'y') {
				return (date.getFullYear() + '').substr(4 - all.length);
			}
			return all;
		});
		return format;
	},showTip = function(content,type,time){
		var typeStr = "default";
		if(typeof type=="number"){
			switch(type){
			case 1:typeStr="success";break;
			case 2:typeStr="danger";break;
			case 3:typeStr="warning";break;
			case 4:typeStr="info";break;
			}
		}
		top.mini.showTips({
			content:content,
			state:typeStr,
			x:"center",
			y:"center",
			timeout:time
		});
	},getTopWindowSize = function(){
		var height = top.window.document.body.scrollHeight;
		var width = top.window.document.body.scrollWidth;
		return{width: width, height: height};
	}

	commonTools = {
		/* miniui grid */
		combineGridCol2Str : formatRowIds,
		/* cookie */
		setCookie : setCookie,
		getCookie : getCookie,
		/* 浏览器 */
		browserVersion : getBrowserVersion,
		getParamByName : getParamByName,
		getUrlParam : getUrlParam,
		getAllUrlParams : getAllUrlParams,
		getWindowLocation : getWindowLocation,
		refreshSubPageHeight : refreshSubPageHeight,
		dateGMTToStr : dateGMTToStr,
		dateFormat : dateFormat,
		showTip:showTip,
		getTopWindowSize : getTopWindowSize
	};
})(jQuery);

/**
 * 导航
 */
(function($) {
	var settings = {
		rootPath : null,
		naviTree : null,
		treeData : null,
		$subPageFrame : null,
		defaultNodeId : null
	}, historyUrl = new Array(), currentPage = null, refreshSubPage = function() {
		document.getElementById("contentFrame").contentWindow.location.reload();
	}, locateByNode = function(node) {
		if (settings.naviTree != null
				|| typeof settings.naviTree != "undefined") {
			if (typeof node != "undefined") {
				var url = node.value;
				if (url == "") {
					return;
				}
				var params = commonTools.getAllUrlParams();
				if (params != null) {
					url += "?" + params;
				}
				settings.$subPageFrame.attr('src', url);

				if (currentPage != null) {
					historyUrl.push(currentPage);
				}
				var loadPageObj = new Object();
				loadPageObj.id = node.id;
				loadPageObj.url = url;
				currentPage = loadPageObj;
			}
		}
	}, treeClickEvent = function(e) {
		var node = e.node;
		if (settings.naviTree != null
				|| typeof settings.naviTree != "undefined") {
			if (typeof node != "undefined") {
				var url = node.value;
				if (url == "") {
					return;
				}
				window.location = commonTools.getWindowLocation() + "?no="
						+ node.id;
			}
		}
	}, locateByNodeId = function(nodeId) {
		var nodes = getNodeById(nodeId);
		if (typeof nodes != "undefined" && nodes != null && nodes.length > 0) {
			var node = nodes[0];
			settings.naviTree.select(node);
			locateByNode(node);

			var parents = settings.naviTree.getAncestors(node);
			for (var i = 0, length = parents.length; i < length; i++) {
				settings.naviTree.expandNode(parents[i]);
			}
		}
	}, getNodeById = function(nodeId) {
		return settings.naviTree.findNodes(function(node) {
			if (node.id == nodeId)
				return true;
		});
	}, selectNode = function(nodeId) {
		var nodes = getNodeById(nodeId);
		if (typeof nodes != "undefined" && nodes != null && nodes.length > 0) {
			var node = nodes[0];
			settings.naviTree.select(node);
			var parents = settings.naviTree.getAncestors(node);
			for (var i = 0, length = parents.length; i < length; i++) {
				settings.naviTree.expandNode(parents[i]);
			}
		}
	}, locateByUrl = function(url) {
		settings.$subPageFrame.attr('src', url);
	}, prevPage = function() {
		if (historyUrl.length > 0) {
			var prevPageObj = historyUrl.pop();
			locateByUrl(prevPageObj.url);
			selectNode(prevPageObj.id);
		}
	};
	ini = function(targetPan) {
		$targetPan = $(targetPan);
		// load数据
		settings.naviTree.loadList(settings.treeData, 'id', 'pid');

		// 获取url上的no，如果no没有则取cookie中的no
		var no = commonTools.getUrlParam("no");
		if (typeof no == "undefined" || no == null) {
			no = settings.defaultNodeId;
		}
		if (typeof no != "undefined" && no != null) {
			locateByNodeId(no);
		}
	};

	$.fn.navi = function(options) {
		settings = $.extend(settings, options || {});
		ini(this);
		return navi = {
			refreshSubPage : refreshSubPage,
			locateByNodeId : locateByNodeId,
			locateByNode : locateByNode,
			locateByUrl : locateByUrl,
			treeClickEvent : treeClickEvent,
			prevPage : prevPage,
			selectNode : selectNode
		};
	};
})(jQuery);

/**
 * 顶部导航
 */
(function($) {
	var settings = {
		showNaviBtn : true, // 是否显示 站点间导航
		showSiteLink : true, // 是否显示 站点内跳转链接
		showLoginInfo : true, // 是否显示 登录人信息
		showLogoutBtn : true, // 是否显示 退出按钮
		maskLayer : null, // 遮盖层
		rootPath : "", // 根路径
		userName : "",
		loginName : null,
		logoutUrl : null,
		naviBtnData : null,
		siteLinkData : null,
		isInner : true
	}, $rootObj = null, $naviPan = null, $naviHoverPan = null, $userPan = null, buildNaviBtn = function() { // build站点间导航
		if (settings.showNaviBtn === true && settings.naviBtnData != null) {
			var $homeBtn = $('<li class="topHomeLink"><a class="homeIcon" href="javascript:void(0)"></a></li>');
			$homeBtn.click(function() {
				showNaviPan();
			}).hover(function() {
				$(this).addClass("active");
			}, function() {
				$(this).removeClass("active");
			});
			$naviHoverPan = $('<div class="topHomeListPan"><div style="height:32px;width:100%;display: block;"></div><div class="topHomeListTitle"><div class="topHomeLinkHover"><a class="homeIcon" href="javascript:void(0)"></a></div></div></div>');
			$naviHoverPan.find('.topHomeListPan').click(hideNaviPan);
			for (var i = 0, length = settings.naviBtnData.length; i < length; i++) {
				var item = settings.naviBtnData[i];
				var url = settings.isInner ? item.innerUrl : item.outterUrl;
				var itemHTML = '<div class="sysNaviItem"><a class="itemlink" href="'
						+ url
						+ '"></a><div style="height:0px"></div><div class="itemPic" style="background-image:url('
						+ item.imgUrl
						+ ')"></div><p class="itemTag" >'
						+ item.name + '</p></div>';
				$naviHoverPan.append(itemHTML);
			}
			$naviHoverPan.find(".sysNaviItem").hover(function() {
				$(this).addClass("sysNaviItemHover");
			}, function() {
				$(this).removeClass("sysNaviItemHover");
			});
			$naviHoverPan.find(".topHomeLinkHover").click(hideNaviPan);
			$homeBtn.click(showNaviPan).hover(function() {
				$(this).addClass("active");
			}, function() {
				$(this).removeClass("active");
			});
			$naviPan.find(".topNaviBar").append($homeBtn);
			$rootObj.append($naviHoverPan);
		}
	}, buildSiteLink = function() { // build站点内跳转链接
		$linkBar = $naviPan.find(".topNaviBar");
		if (settings.showSiteLink === true && settings.siteLinkData != null) {
			for (var i = 0, length = settings.siteLinkData.length; i < length; i++) {
				var item = settings.siteLinkData[i];
				var itemHtml = '<li class="topLink" ><a class="aTagTop topTagLink" href="'
						+ item.url + '">' + item.name + '</a></li>';
				$linkBar.append(itemHtml);
			}
		}
		$linkBar.find(".topLink").hover(function() {
			$(this).addClass("active");
		}, function() {
			$(this).removeClass("active");
		});

	}, buildLoginInfo = function() { // build登录人信息
		if (settings.showLoginInfo === true) {
			$userPan.append("当前登录：" + settings.userName+"&nbsp;&nbsp;");
		}
	}, buildLogoutBtn = function() { // build退出按钮
		if (settings.showLogoutBtn === true) {
			$userPan
					.append('<a href=\"'
							+ settings.logoutUrl
							+ '\" style="color:white;text-decoration: none;">[退出系统]</a>');
		}
	}, showNaviPan = function() {
		if ($naviHoverPan != null) {
			$naviHoverPan.show();
		}
		if (settings.maskLayer != null) {
			settings.maskLayer.show();
		}
	}, hideNaviPan = function() {
		if ($naviHoverPan != null) {
			$naviHoverPan.hide();
		}
		if (settings.maskLayer != null) {
			settings.maskLayer.hide();
		}
	}, ini = function(targetPan) {
		$rootObj = $(targetPan);
		$topNaviScaffold = $(targetPan.find(".t_bg")[0]);
		if (settings.showNaviBtn === true || settings.showSiteLink === true) {
			$naviPan = $('<div id="topNaviCommon topLeftBar"><ul class="topNaviBar"></ul></div>');
			$rootObj.append($naviPan);
		}
		if (settings.showLoginInfo === true || settings.showLogoutBtn === true) {
			$userPan = $('<div class="topNaviCommon topRightPan btn-primary"></div>');
			$rootObj.append($userPan);
		}
		buildNaviBtn();
		buildSiteLink();
		buildLoginInfo();
		buildLogoutBtn();
		if (settings.maskLayer != null) {
			settings.maskLayer.click(hideNaviPan);
		}
	};

	$.fn.topNavi = function(options) {
		settings = $.extend(settings, options || {});
		ini(this);
	};
})(jQuery);

/**
 * 收缩按钮
 */
(function($) {
	var settings = {
		slidePan : null
	}, ini = function(targetPan) {
		$targetPan = $(targetPan);
		var $rightHover = $("<div class='rightHover'>");
		var $btn = $('<div class="btn"></div>');

		$btn.toggle(function() {
			settings.slidePan.clearQueue().stop().animate({
				width : '0px'
			}, 500, function() {
				$btn.addClass("rightHoverHide");
			});
			commonTools.setCookie("isHideLeftTree", true, 30);
		}, function() {
			settings.slidePan.clearQueue().stop().animate({
				width : '190px'
			}, 500, function() {
				$btn.removeClass("rightHoverHide");
			});
			commonTools.setCookie("isHideLeftTree", false, 30);
		});
		$btn.hover(function() {
			$(this).addClass("rightHoverPoint");
		}, function() {
			$(this).removeClass("rightHoverPoint");
		});
		$rightHover.append($btn);
		$targetPan.append($rightHover);

		var isHideLeftTree = commonTools.getCookie("isHideLeftTree");
		if (isHideLeftTree != null && isHideLeftTree != ''
				&& isHideLeftTree == "true") {
			settings.slidePan.clearQueue().stop().animate({
				width : '0px'
			}, 0);
			$btn.click();
		}
	};

	$.fn.collapseBtn = function(options) {
		settings = $.extend(settings, options || {});
		ini(this);
	};
})(jQuery);
/**
 * tips
 */
(function($) {
	var settings = {
		wsPath : null,
		keyAttr : "html"
	}, 
	JT_show = function(url, linkId, title, width, height) {
		var tdocument = top.document;
		var $=top.$;
		if (title == false)
			title = "&nbsp;";
		var de = tdocument.documentElement;
		var w = top.self.innerWidth || (de && de.clientWidth) || tdocument.body.clientWidth;
		var hasArea = w - getAbsoluteLeft(linkId);
		var clickElementy = getAbsoluteTop(linkId) - 3; // y 纵向位置

		var queryString = url.replace(/^[^\?]+\??/, '');
		var params = parseQuery(queryString);
		if (params['width'] === undefined) {
			params['width'] = 250
		}
		;
		if (params['link'] !== undefined) {
			$('#' + linkId).bind('click', function() {
				window.location = params['link']
			});
			$('#' + linkId).css('cursor', 'pointer');
		}
		var browserVersion = commonTools.browserVersion();
		/*if(true){*/
		/*if(browserVersion=="MSIE 7.0"||browserVersion=="MSIE 8.0"||browserVersion=="MSIE 9.0"){*/
			if(hasArea>(width+75)){
				var $tipPan = $("<div id='JT' style='width:"+width+"px;'><div id='JT_arrow_left'></div><div id='JT_close_left'>"
						+title+"</div><div id='JT_copy' style='padding:0 !important;'><iframe class='JT_loader' frameborder ='no' style='height:"+height+"px;'></iframe>"); //right side
				var frame = $tipPan.find(".JT_loader").get(0);
				if(browserVersion=="MSIE 9.0"){
					frame.style.backgroundImage="";
				}
				top.$("body").append($tipPan);
				var arrowOffset = getElementWidth(linkId) + 11;
				var clickElementx = getAbsoluteLeft(linkId) + arrowOffset; //set x position
			}else{
				var $tipPan = $("<div id='JT' style='width:"+width+"px'><div id='JT_arrow_right' style='left:"
						+(width+1)+"px'></div><div id='JT_close_right'>"+title
						+"</div><div id='JT_copy' style='padding:0 !important;'><iframe class='JT_loader' frameborder ='no' style='height:"+height+"px;'></iframe>");//left side
				$tipPan.find(".JT_loader").bind("load",function(){
					$(this).css("background-image","");
				});
				top.$("body").append($tipPan);
				var clickElementx = getAbsoluteLeft(linkId) - (width + 15); //set x position
			}
			
			top.$('#JT').css({left: clickElementx+"px", top: clickElementy+"px"});
			top.$('#JT').show();
			top.$('.JT_loader').attr("src",url);
		/*}
		else{
			if(hasArea>((params['width']*1)+75)){
				$("body").append("<div id='JT' style='width:"+params['width']*1+"px'><div id='JT_arrow_left'></div><div id='JT_close_left'>"+title+"</div><div id='JT_copy'><div class='JT_loader'><div></div></div>");//right side
				var arrowOffset = getElementWidth(linkId) + 11;
				var clickElementx = getAbsoluteLeft(linkId) + arrowOffset; //set x position
			}else{
				$("body").append("<div id='JT' style='width:"+params['width']*1+"px'><div id='JT_arrow_right' style='left:"+((params['width']*1)+1)+"px'></div><div id='JT_close_right'>"+title+"</div><div id='JT_copy'><div class='JT_loader'><div></div></div>");//left side
				var clickElementx = getAbsoluteLeft(linkId) - ((params['width']*1) + 15); //set x position
			}
			$('#JT').css({left: clickElementx+"px", top: clickElementy+"px"});
			$('#JT').show();
			$('#JT_copy').load(url);
		}*/
	},
	getElementWidth = function(objectId) {
		x = document.getElementById(objectId);
		return x.offsetWidth;
	},
	//获取指定Id元素的left距离
	getAbsoluteLeft = function(objectId) {
		var o = document.getElementById(objectId),
		oLeft = o.offsetLeft;
		while (o.offsetParent != null) { 
			oParent = o.offsetParent;
			oLeft += oParent.offsetLeft;
			o = oParent;
		}
		var wt=window.top;
        var w=window;
        if(w!=wt){
            var wp=window.parent;
            while(w!=wt){
                var ifr=getThisIframe(w,wp);
                var _of;
                if(ifr){
                    _of=$(ifr).offset();
                }else{
                    _of=new Object();
                    _of.top=0;
                    _of.left=0;
                }
                oLeft+=_of.left;
                w=wp;
                wp=w.parent;
            }
        }
		return oLeft;
	},
	getThisIframe=function(w,wp){
        var ifr;
        $(wp.document).find("iframe").each(function(i5,o5){
            if(o5.contentWindow==w){
                ifr=o5;
                return false;
            }
        });
        return ifr;
    },
	//获取指定Id元素的top距离
	getAbsoluteTop = function(objectId) {
		var o = document.getElementById(objectId),
		oTop = o.offsetTop;
		while (o.offsetParent != null) {
			var oParent = o.offsetParent;
			oTop += oParent.offsetTop;
			o = oParent;
		}
		var wt=window.top;
        var w=window;
        if(w!=wt){
            var wp=window.parent;
            while(w!=wt){
                var ifr=getThisIframe(w,wp);
                var _of;
                if(ifr){
                    _of=$(ifr).offset();
                }else{
                    _of=new Object();
                    _of.top=0;
                    _of.left=0;
                }
                oTop+=_of.top;
                w=wp;
                wp=w.parent;
            }
        }
		return oTop;
	},
	//拆开url，并获得其中参数及其值，返回一个装有参数值的数组
	parseQuery = function(query) {
		var Params = new Object();
		if (!query)
			return Params; // return empty object
		var Pairs = query.split(/[;&]/);
		for (var i = 0; i < Pairs.length; i++) {
			var KeyVal = Pairs[i].split('=');
			if (!KeyVal || KeyVal.length != 2)
				continue;
			var key = unescape(KeyVal[0]);
			var val = unescape(KeyVal[1]);
			val = val.replace(/\+/g, ' ');
			Params[key] = val;
		}
		return Params;
	},
	blockEvents = function(evt) {
		if (evt.target) {
			evt.preventDefault();
		} else {
			evt.returnValue = false;
		}
	},
	ini = function(targets) {
		var tipTypes = "";
		var $jTips = $(targets);
		var idCountNo = 0;
		var idPrefix = "aTagTip";
		$jTips.each(function(){
			var $this = $(this);
			var thisHtmlObj =$this.get(0);
			var itemId = thisHtmlObj.id;
			if(typeof itemId == "undefined"||itemId==""){
				thisHtmlObj.id = idPrefix+idCountNo;
				//$this.attr("id",idPrefix+idCountNo);
				idCountNo++;
			}
			var tiptype = $this.attr("tipType");
			if(typeof tiptype=="undefined" && tiptype==null)return;
			if(tipTypes.length>0){
				tipTypes+=",";
			}
			tipTypes+=tiptype;
		});
		if(tipTypes.length>0){
			$.ajax({
				url : settings.wsPath,
				type : "post",
				dataType:'json',
				data:{
					nos:tipTypes
				},
				success : function(text) {
					if(typeof text == "object"){						
						$jTips.each(function(){
							var $this = $(this);
							var tiptype = $this.attr("tipType");
							if(typeof tiptype=="undefined" && tiptype==null)return;
							var tipType = eval("text."+tiptype);
							if(typeof tipType != "undefined"){
								var tipType = $.parseJSON(tipType);
								var path = tipType.path,
								width = tipType.width,
								height = tipType.height,
								title = tipType.showTitle;
								
								var queryValue = null;
								if(settings.keyAttr=="html"){
									queryValue = $this.html();
								}else{
									queryValue = eval("$this.attr('"+settings.keyAttr+"')");
								}
								
								$this.attr("href",path+queryValue);
								$this.attr("width",width);
								$this.attr("height",height);
								$this.attr("title",title);
							}
						});
						$("a.jTip").hover(function() {
							var $this = $(this);
							var tWidth = $this.attr("width");
							if(typeof tWidth!="undefined" && tWidth != null && tWidth != ""){
								tWidth = new Number(tWidth);
							}
							else{
								tWidth = 250;
							}
							var tHeight = $this.attr("height");
							var tTitlet = $this.attr("title");
							JT_show(this.href, this.id, tTitlet, tWidth, tHeight);
						}, function() {
							top.$('#JT').remove()
						}).click(function() {
							return false
						});
					}
				},
				complete: function(XMLHttpRequest, textStatus){
					
				},
				error : function() {
					
				}
			});
		}
		
	};

	$.fn.jtips = function(options) {
		settings = $.extend(settings, options || {});
		ini(this);
	};
})(jQuery);

/*
 * breadcrumb
 */
(function($) {
	var settings = {
		data : null
	}, ini = function(targetPan) {
		$targetPan = $(targetPan);
		var hasParentNavi = false;
		if (typeof parent.naviManager != "undefined") {
			hasParentNavi = true;
		}
		if (settings.data != null && settings.data.length > 0) {
			var data = $.parseJSON(settings.data);
			var targetStr = "";
			for (var i = 0, length = data.length; i < length; i++) {
				var row = data[i];
				if (i === 0) {
					targetStr += formatCrumb(data[i], true, hasParentNavi);
				} else {
					targetStr += formatCrumb(data[i], false, hasParentNavi);
				}
			}
			$targetPan.append(targetStr);
		}

	}, formatCrumb = function(node, isfirst, hasParentNavi) {
		var targetStr = "";
		if (isfirst === false) {
			targetStr += "&gt;";
		}
		if (typeof node.value == "undefined" || node.value == null
				|| node.value == "") {
			targetStr += "<span>" + node.pageName + "</span>";
		} else {
			if (hasParentNavi === true) {
				targetStr += "<a href='javascript:parent.naviManager.locateByNodeId("
						+ node.id + ")'>" + node.pageName + "</a>";
			} else {
				targetStr += "<a href='" + node.value + "'>" + node.pageName
						+ "</a>";
			}
		}
		return targetStr;
	}, appendNode = function(nodeName) {
		if (typeof nodeName != "undefined" && nodeName != null
				&& nodeName.length > 22) {
			nodeName = "<span style='cursor:pointer' title='" + nodeName + "'>"
					+ nodeName.substring(0, 21) + "..." + "</span>";
		}
		var existNode = $targetPan.find(".appendItem");
		if (existNode.length > 0) {
			$(existNode).html(nodeName);
		} else {
			$targetPan
					.append("<div class='appendItemSpliter' style='display:inline'>&gt;</div><span class='appendItem'>"
							+ nodeName + "</span>");
		}
	}, appendLink = function(linkName, callFunc) {
		$targetPan.append("<a class='appendLink' href='javascript:void(0)'>"
				+ linkName + "</a>");
		$targetPan.find(".appendLink").click(callFunc);
	}, removeAppend = function() {
		$targetPan.find('.appendItem').remove();
		$targetPan.find('.appendItemSpliter').remove();
	}, removeLink = function() {
		$targetPan.find(".appendLink").remove();
	};

	$.fn.breadCrumb = function(options) {
		settings = $.extend(settings, options || {});
		ini(this);
		return breadCrumb = {
			appendNode : appendNode,
			appendLink : appendLink,
			removeAppend : removeAppend,
			removeLink: removeLink
		}
	};
})(jQuery);

/*
 * tooltip in same domain
 */
(function($) {
	var settings = {
		tType : "html",
		tWidth : "200",
		tHeight : "100"
	}, iJT_show = function(url, linkId, title) {
		if (title == false)
			title = "&nbsp;";
		var de = document.documentElement;
		var w = self.innerWidth || (de && de.clientWidth)
				|| document.body.clientWidth;
		var hasArea = w - getAbsoluteLeft(linkId);
		var clickElementy = getAbsoluteTop(linkId) - 3; // set y position

		var queryString = url.replace(/^[^\?]+\??/, '');
		var params = parseQuery(queryString);
		if (params['width'] === undefined) {
			params['width'] = 250
		}
		;
		if (params['link'] !== undefined) {
			$('#' + linkId).bind('click', function() {
				window.location = params['link']
			});
			$('#' + linkId).css('cursor', 'pointer');
		}

		if (hasArea > ((params['width'] * 1) + 75)) {
			$("body")
					.append(
							"<div id='JT' style='width:"
									+ params['width']
									* 1
									+ "px'><div id='JT_arrow_left'></div><div id='JT_close_left'>"
									+ title
									+ "</div><div id='JT_copy'><div class='JT_loader'><div></div></div>");// right
																											// side
			var arrowOffset = getElementWidth(linkId) + 11;
			var clickElementx = getAbsoluteLeft(linkId) + arrowOffset; // set x
																		// position
		} else {
			$("body")
					.append(
							"<div id='JT' style='width:"
									+ params['width']
									* 1
									+ "px'><div id='JT_arrow_right' style='left:"
									+ ((params['width'] * 1) + 1)
									+ "px'></div><div id='JT_close_right'>"
									+ title
									+ "</div><div id='JT_copy'><div class='JT_loader'><div></div></div>");// left
																											// side
			var clickElementx = getAbsoluteLeft(linkId)
					- ((params['width'] * 1) + 15); // set x position
		}

		$('#JT').css({
			left : clickElementx + "px",
			top : clickElementy + "px"
		});
		$('#JT').show();
		$('#JT_copy').load(url);
	}, iJT_Ajax_show = function(url, linkId, title, width, height) {
		if (title == false)
			title = "&nbsp;";
		var de = document.documentElement;
		var w = self.innerWidth || (de && de.clientWidth)
				|| document.body.clientWidth;
		var hasArea = w - getAbsoluteLeft(linkId);
		var clickElementy = getAbsoluteTop(linkId) - 3; // set y position

		var queryString = url.replace(/^[^\?]+\??/, '');
		var params = parseQuery(queryString);
		if (params['width'] === undefined) {
			params['width'] = 250
		}
		;
		if (params['link'] !== undefined) {
			$('#' + linkId).css('cursor', 'pointer');
		}

		if (hasArea > ((width * 1) + 75)) {
			$("body")
					.append(
							"<div id='JT' style='width:"
									+ width
									* 1
									+ "px'><div id='JT_arrow_left'></div><div id='JT_close_left'>"
									+ title
									+ "</div><div id='JT_copy'><div class='JT_loader'><div></div></div>");// right
																											// side
			var arrowOffset = getElementWidth(linkId) + 11;
			var clickElementx = getAbsoluteLeft(linkId) + arrowOffset; // set x
																		// position
		} else {
			$("body")
					.append(
							"<div id='JT' style='width:"
									+ width
									* 1
									+ "px'><div id='JT_arrow_right' style='left:"
									+ ((width * 1) + 1)
									+ "px'></div><div id='JT_close_right'>"
									+ title
									+ "</div><div id='JT_copy'><div class='JT_loader'><div></div></div>");// left
																											// side
			var clickElementx = getAbsoluteLeft(linkId) - ((width * 1) + 15); // set
																				// x
																				// position
		}

		$('#JT').css({
			left : clickElementx + "px",
			top : clickElementy + "px"
		});
		$('#JT').show();
		$.ajax({
			url : url,
			type : "get",
			dataType : 'html',
			success : function(text) {
				$('#JT_copy').css({
					"word-wrap" : "break-word",
					"word-break" : "break-all"
				}).html(text);
			},
			error : function() {
				alert("获取数据出错!");
			}
		});
	}, iJT_Html_show = function(targetid, linkId, title, width, height) {
		if (title == false)
			title = "&nbsp;";
		var de = document.documentElement;
		var w = self.innerWidth || (de && de.clientWidth)
				|| document.body.clientWidth;
		var hasArea = w - getAbsoluteLeft(linkId);
		var clickElementy = getAbsoluteTop(linkId) - 3; // set y position

		$('#' + linkId).css('cursor', 'pointer');

		if (hasArea > ((width * 1) + 75)) {
			$("body")
					.append(
							"<div id='JT' style='width:"
									+ width
									* 1
									+ "px'><div id='JT_arrow_left'></div><div id='JT_close_left'>"
									+ title
									+ "</div><div id='JT_copy'><div class='JT_loader'><div></div></div>");// right
																											// side
			var arrowOffset = getElementWidth(linkId) + 11;
			var clickElementx = getAbsoluteLeft(linkId) + arrowOffset; // set x
																		// position
		} else {
			$("body")
					.append(
							"<div id='JT' style='width:"
									+ width
									* 1
									+ "px'><div id='JT_arrow_right' style='left:"
									+ ((width * 1) + 1)
									+ "px'></div><div id='JT_close_right'>"
									+ title
									+ "</div><div id='JT_copy'><div class='JT_loader'><div></div></div>");// left
																											// side
			var clickElementx = getAbsoluteLeft(linkId) - ((width * 1) + 15); // set
																				// x
																				// position
		}

		$('#JT').css({
			left : clickElementx + "px",
			top : clickElementy + "px"
		});
		$('#JT').show();
		$('#JT_copy').css({
			"word-wrap" : "break-word",
			"word-break" : "break-all"
		}).html($("#" + targetid).html());
	}, getElementWidth = function(objectId) {
		x = document.getElementById(objectId);
		return x.offsetWidth;
	},
	// 获取指定Id元素的left距离
	getAbsoluteLeft = function(objectId) {
		o = document.getElementById(objectId)
		oLeft = o.offsetLeft;
		while (o.offsetParent != null) {
			oParent = o.offsetParent;
			oLeft += oParent.offsetLeft;
			o = oParent;
		}
		return oLeft;
	},
	// 获取指定Id元素的top距离
	getAbsoluteTop = function(objectId) {
		o = document.getElementById(objectId)
		oTop = o.offsetTop
		while (o.offsetParent != null) {
			oParent = o.offsetParent;
			oTop += oParent.offsetTop;
			o = oParent;
		}
		return oTop;
	},
	// 拆开url，并获得其中参数及其值，返回一个装有参数值的数组
	parseQuery = function(query) {
		var Params = new Object();
		if (!query)
			return Params; // return empty object
		var Pairs = query.split(/[;&]/);
		for (var i = 0; i < Pairs.length; i++) {
			var KeyVal = Pairs[i].split('=');
			if (!KeyVal || KeyVal.length != 2)
				continue;
			var key = unescape(KeyVal[0]);
			var val = unescape(KeyVal[1]);
			val = val.replace(/\+/g, ' ');
			Params[key] = val;
		}
		return Params;
	}, blockEvents = function(evt) {
		if (evt.target) {
			evt.preventDefault();
		} else {
			evt.returnValue = false;
		}
	}, ini = function(targets) {
		$(targets).hover(
				function() {
					$this = $(this);
					var tType = $this.attr("tType");
					if (typeof tType != "undefined") {
						switch (tType.toLowerCase()) {
						case "html":
							var width = null;
							var height = null;
							if (typeof $this.attr("tWidth") != "undefined") {
								width = $this.attr("tWidth");
							} else {
								width = settings.tWidth;
							}
							if (typeof $this.attr("tHeight") != "undefined") {
								height = $this.attr("tHeight");
							} else {
								height = settings.tHeight;
							}
							iJT_Html_show($this.attr("targetid"), this.id,
									this.name, width, height);
							break;
						;
						break;
					case "ajax":
						var width = null;
						var height = null;
						if (typeof $this.attr("tWidth") != "undefined") {
							width = $this.attr("tWidth");
						} else {
							width = settings.tWidth;
						}
						if (typeof $this.attr("tHeight") != "undefined") {
							height = $this.attr("tHeight");
						} else {
							height = settings.tHeight;
						}
						iJT_Ajax_show($this.attr("href"), this.id, this.name,
								width, height);
						break;
					case "page":
						iJT_show(this.href, this.id, this.name);
						break;
					}
				}
			}, function() {
				$('#JT').remove()
			}).click(function() {
			return false
		});
	};

	$.fn.iJtips = function(options) {
		settings = $.extend(settings, options || {});
		ini(this);
	};
})(jQuery);